package thread.pool;

import java.util.concurrent.Callable;

public class MyFutureTask implements Callable<String> {

    private String taskName;

    private long aliveTime;

    public MyFutureTask() {
    }

    public MyFutureTask(String taskName, long aliveTime) {
        this.taskName = taskName;
        this.aliveTime = aliveTime;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public long getAliveTime() {
        return aliveTime;
    }

    public void setAliveTime(long aliveTime) {
        this.aliveTime = aliveTime;
    }

    @Override
    public String call() throws Exception {
        //模拟超时
        Thread.sleep(aliveTime);
        return this.taskName + "执行";
    }
}
